home *** CD-ROM | disk | FTP | other *** search
/ Games of Daze / Infomagic - Games of Daze (Summer 1995) (Disc 1 of 2).iso / x2ftp / msdos / libs / objeas3a / workshop / modify.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1994-05-18  |  29.2 KB  |  1,376 lines

  1. #include "d:\gui\gui.h"
  2. #include "workshop.h"
  3. #include <conio.h>
  4. #include <stdlib.h>
  5.  
  6. //*************************************************************************
  7. //        FUNCTION PROTOTYPES
  8. //*************************************************************************
  9.  
  10. int modify_panel(panelrec *);
  11. int modify_bevel(bevelrec *);
  12. int modify_checkbox(checkboxrec *);
  13. int modify_radio(radiorec *);
  14. int modify_icon(iconrec *);
  15. int modify_string(stringrec *);
  16. int modify_button(buttonrec *);
  17. int modify_text(textrec *);
  18.  
  19. extern redraw_screen();
  20. extern showmem();
  21.  
  22. //*************************************************************************
  23. //        GLOBAL VARIABLES
  24. //*************************************************************************
  25.  
  26. extern panelrec *panelroot;
  27. extern panelrec *currentpanel;
  28. extern int numpanels;
  29.  
  30. extern bevelrec *bevelroot;
  31. extern bevelrec *currentbevel;
  32. extern int numbevels;
  33.  
  34. extern checkboxrec *checkboxroot;
  35. extern checkboxrec *currentcheckbox;
  36. extern int numcheckboxes;
  37.  
  38. extern radiorec *radioroot;
  39. extern radiorec *currentradio;
  40. extern int numradios;
  41.  
  42. extern iconrec *iconroot;
  43. extern iconrec *currenticon;
  44. extern int numicons;
  45.  
  46. extern stringrec *stringroot;
  47. extern stringrec *curentstring;
  48. extern int numstrings;
  49.  
  50. extern buttonrec *buttonroot;
  51. extern buttonrec *currentbutton;
  52. extern int numbuttons;
  53.  
  54. extern Line line_info[100];
  55. extern int numlines;
  56.  
  57. extern textrec *textroot;
  58. extern textrec *currenttext;
  59. extern numtexts;
  60.  
  61. extern Mcursor the_mouse;
  62.  
  63. //*************************************************************************
  64. //        MODIFY_PANEL
  65. //*************************************************************************
  66.  
  67. int modify_panel(panelrec *the_panelrec)
  68. {
  69.     char ULX[4],ULY[4],W[4],H[4];
  70.     int ready=0;
  71.  
  72. //*****   INITIALIZE THE DIALOG BOX   *****
  73.  
  74.     the_mouse.changeto(ARROW);
  75.     Bevel box;
  76.     box.init(128,117,343,247,THICK);
  77.     box.show();
  78.  
  79.     Panel panel1;
  80.     panel1.init(154,229,87,54,IN,THIN);
  81.     Panel panel2;
  82.     panel2.init(258,229,192,54,IN,THIN);
  83.     Panel panel3;
  84.     panel3.init(258,293,192,53,IN,THIN);
  85.     Panel panel4;
  86.     panel4.init(154,293,87,52,IN,THIN);
  87.     panel1.show();
  88.     panel2.show();
  89.     panel3.show();
  90.     panel4.show();
  91.  
  92.     Button button1;
  93.     button1.init(429,129,"panel",IMAGE);
  94.     Button OK;
  95.     OK.init(275,309,"   OK   ",TEXT);
  96.     Button CANCEL;
  97.     CANCEL.init(361,309," CANCEL ",TEXT);
  98.     button1.show();
  99.     OK.show();
  100.     CANCEL.show();
  101.  
  102.     Gstring name;
  103.     name.init(219,152,20,0);
  104.     name.preset(the_panelrec->name);
  105.     Gstring ulx;
  106.     ulx.init(219,181,3,1);
  107.     itoa(the_panelrec->panel->Getx(),ULX,10);
  108.     ulx.preset(ULX);
  109.     Gstring uly;
  110.     uly.init(219,209,3,1);
  111.     itoa(the_panelrec->panel->Gety(),ULY,10);
  112.     uly.preset(ULY);
  113.     Gstring wd;
  114.     wd.init(340,181,3,1);
  115.     itoa(the_panelrec->panel->Getw(),W,10);
  116.     wd.preset(W);
  117.     Gstring ht;
  118.     ht.init(340,209,3,1);
  119.     itoa(the_panelrec->panel->Geth(),H,10);
  120.     ht.preset(H);
  121.     name.show();
  122.     ulx.show();
  123.     uly.show();
  124.     wd.show();
  125.     ht.show();
  126.  
  127.     Gradio thick;
  128.     thick.init(163,240,"Thick");
  129.     Gradio thin;
  130.     thin.init(163,260,"Thin");
  131.     Gradio in;
  132.     in.init(163,304,"In");
  133.     Gradio out;
  134.     out.init(163,325,"Out");
  135.     thick.show();
  136.     thin.show();
  137.     in.show();
  138.     out.show();
  139.     if(!the_panelrec->panel->Getthick())
  140.         thick.check();
  141.     else
  142.         thin.check();
  143.     if(!the_panelrec->panel->Getin())
  144.         in.check();
  145.     else
  146.         out.check();
  147.  
  148.     Gcheckbox cv;
  149.     cv.init(268,240,"Center Vertically");
  150.     Gcheckbox ch;
  151.     ch.init(268,260,"Center Horizontally");
  152.     cv.show();
  153.     ch.show();
  154.  
  155.     Gtext text1;
  156.     text1.init(161,148,"Name:",0,7,1);
  157.     Gtext text2;
  158.     text2.init(168,176,"ULX:",0,7,1);
  159.     Gtext text3;
  160.     text3.init(168,205,"ULY:",0,7,1);
  161.     Gtext text4;
  162.     text4.init(280,175,"Width:",0,7,1);
  163.     Gtext text5;
  164.     text5.init(273,204,"Height:",0,7,1);
  165.     text1.show();
  166.     text2.show();
  167.     text3.show();
  168.     text4.show();
  169.     text5.show();
  170.  
  171. //*****   INPUT LOOP   *****
  172.  
  173.     name.get_form_mouse_input();
  174.     while(!ready) {
  175.         if(the_mouse.LBP()) {
  176.             if(name.hit()) {
  177.                 while(the_mouse.LBP());
  178.                 name.get_form_mouse_input();
  179.                 }
  180.             if(ulx.hit()) {
  181.                 while(the_mouse.LBP());
  182.                 ulx.get_form_mouse_input();
  183.                 }
  184.             if(uly.hit()) {
  185.                 while(the_mouse.LBP());
  186.                 uly.get_form_mouse_input();
  187.                 }
  188.             if(wd.hit()) {
  189.                 while(the_mouse.LBP());
  190.                 wd.get_form_mouse_input();
  191.                 }
  192.             if(ht.hit()) {
  193.                 while(the_mouse.LBP());
  194.                 ht.get_form_mouse_input();
  195.                 }
  196.             if(thick.hit()) {
  197.                 if(!thick.is_checked()) {
  198.                     thick.check();
  199.                     thin.uncheck();
  200.                     }
  201.                 while(the_mouse.LBP());
  202.                 }
  203.             if(thin.hit()) {
  204.                 if(!thin.is_checked()) {
  205.                     thin.check();
  206.                     thick.uncheck();
  207.                     }
  208.                 while(the_mouse.LBP());
  209.                 }
  210.             if(in.hit()) {
  211.                 if(!in.is_checked()) {
  212.                     in.check();
  213.                     out.uncheck();
  214.                     }
  215.                 while(the_mouse.LBP());
  216.                 }
  217.             if(out.hit()) {
  218.                 if(!out.is_checked()) {
  219.                     out.check();
  220.                     in.uncheck();
  221.                     }
  222.                 while(the_mouse.LBP());
  223.                 }
  224.             if(cv.hit()) {
  225.                 if(cv.is_checked())
  226.                     cv.uncheck();
  227.                 else
  228.                     cv.check();
  229.                 while(the_mouse.LBP());
  230.                 }
  231.             if(ch.hit()) {
  232.                 if(ch.is_checked())
  233.                     ch.uncheck();
  234.                 else
  235.                     ch.check();
  236.                 while(the_mouse.LBP());
  237.                 }
  238.             if(OK.hit()) {
  239.                 OK.press();
  240.                 while(OK.hit() && the_mouse.LBP());
  241.                 OK.show();
  242.                 if((atoi(wd.getstring())<5) ||
  243.                    (atoi(ht.getstring())<5)) {
  244.                     beep();
  245.                     continue;
  246.                     }
  247.                 if(OK.hit())
  248.                     ready=1;
  249.                 }
  250.             if(CANCEL.hit()) {
  251.                 CANCEL.press();
  252.                 while(CANCEL.hit() && the_mouse.LBP());
  253.                 CANCEL.show();
  254.                 if(CANCEL.hit()) {
  255.                     redraw_screen();
  256.                     return 0;
  257.                     }
  258.                 }
  259.             }//if LBP
  260.         }//while !ready
  261.  
  262.     strcpy(the_panelrec->name,name.getstring());
  263.     int newulx=atoi(ulx.getstring());
  264.     int newuly=atoi(uly.getstring());
  265.     int neww=atoi(wd.getstring());
  266.     int newh=atoi(ht.getstring());
  267.     int newthickorthin=thin.is_checked();
  268.     int newinorout=out.is_checked();
  269.     if(cv.is_checked())
  270.         newuly=((getmaxy()/2)-(newh/2));
  271.     if(ch.is_checked())
  272.         newulx=((getmaxx()/2)-(neww/2));
  273.  
  274.     the_panelrec->panel->reinit(newulx,newuly,neww,newh,newinorout,newthickorthin);
  275.  
  276.     redraw_screen();
  277.     return 1;
  278. }
  279.  
  280. //*************************************************************************
  281. //        MODIFY_BEVEL
  282. //*************************************************************************
  283.  
  284. int modify_bevel(bevelrec *the_bevelrec)
  285. {
  286.     char ULX[4],ULY[4],W[4],H[4];
  287.     int ready=0;
  288.  
  289. //*****   INITIALIZE THE DIALOG BOX   *****
  290.  
  291.     the_mouse.changeto(ARROW);
  292.     Bevel box;
  293.     box.init(128,117,344,231,THICK);
  294.     box.show();
  295.  
  296.     Panel panel1;
  297.     panel1.init(154,229,87,54,IN,THIN);
  298.     Panel panel2;
  299.     panel2.init(258,229,192,54,IN,THIN);
  300.     Panel panel3;
  301.     panel3.init(154,293,297,40,IN,THIN);
  302.     panel1.show();
  303.     panel2.show();
  304.     panel3.show();
  305.  
  306.     Button button1;
  307.     button1.init(429,129,"bevel",IMAGE);
  308.     Button OK;
  309.     OK.init(200,305,"   OK   ",TEXT);
  310.     Button CANCEL;
  311.     CANCEL.init(329,305," CANCEL ",TEXT);
  312.     button1.show();
  313.     OK.show();
  314.     CANCEL.show();
  315.  
  316.     Gstring name;
  317.     name.init(219,152,20,0);
  318.     name.preset(the_bevelrec->name);
  319.     Gstring ulx;
  320.     ulx.init(219,181,3,1);
  321.     itoa(the_bevelrec->bevel->Getx(),ULX,10);
  322.     ulx.preset(ULX);
  323.     Gstring uly;
  324.     uly.init(219,209,3,1);
  325.     itoa(the_bevelrec->bevel->Gety(),ULY,10);
  326.     uly.preset(ULY);
  327.     Gstring wd;
  328.     wd.init(340,181,3,1);
  329.     itoa(the_bevelrec->bevel->Getw(),W,10);
  330.     wd.preset(W);
  331.     Gstring ht;
  332.     ht.init(340,209,3,1);
  333.     itoa(the_bevelrec->bevel->Geth(),H,10);
  334.     ht.preset(H);
  335.     name.show();
  336.     ulx.show();
  337.     uly.show();
  338.     wd.show();
  339.     ht.show();
  340.  
  341.     Gradio thick;
  342.     thick.init(163,240,"Thick");
  343.     Gradio thin;
  344.     thin.init(163,260,"Thin");
  345.     thick.show();
  346.     thin.show();
  347.     if(!the_bevelrec->bevel->Getthick())
  348.         thick.check();
  349.     else
  350.         thin.check();
  351.  
  352.     Gcheckbox cv;
  353.     cv.init(268,240,"Center Vertically");
  354.     Gcheckbox ch;
  355.     ch.init(268,260,"Center Horizontally");
  356.     cv.show();
  357.     ch.show();
  358.  
  359.     Gtext text1;
  360.     text1.init(161,148,"Name:",0,7,1);
  361.     Gtext text2;
  362.     text2.init(168,176,"ULX:",0,7,1);
  363.     Gtext text3;
  364.     text3.init(168,205,"ULY:",0,7,1);
  365.     Gtext text4;
  366.     text4.init(280,175,"Width:",0,7,1);
  367.     Gtext text5;
  368.     text5.init(273,204,"Height:",0,7,1);
  369.     text1.show();
  370.     text2.show();
  371.     text3.show();
  372.     text4.show();
  373.     text5.show();
  374.  
  375. //*****   INPUT LOOP   *****
  376.  
  377.     name.get_form_mouse_input();
  378.     while(!ready) {
  379.         if(the_mouse.LBP()) {
  380.             if(name.hit()) {
  381.                 while(the_mouse.LBP());
  382.                 name.get_form_mouse_input();
  383.                 }
  384.             if(ulx.hit()) {
  385.                 while(the_mouse.LBP());
  386.                 ulx.get_form_mouse_input();
  387.                 }
  388.             if(uly.hit()) {
  389.                 while(the_mouse.LBP());
  390.                 uly.get_form_mouse_input();
  391.                 }
  392.             if(wd.hit()) {
  393.                 while(the_mouse.LBP());
  394.                 wd.get_form_mouse_input();
  395.                 }
  396.             if(ht.hit()) {
  397.                 while(the_mouse.LBP());
  398.                 ht.get_form_mouse_input();
  399.                 }
  400.             if(thick.hit()) {
  401.                 if(!thick.is_checked()) {
  402.                     thick.check();
  403.                     thin.uncheck();
  404.                     }
  405.                 while(the_mouse.LBP());
  406.                 }
  407.             if(thin.hit()) {
  408.                 if(!thin.is_checked()) {
  409.                     thin.check();
  410.                     thick.uncheck();
  411.                     }
  412.                 while(the_mouse.LBP());
  413.                 }
  414.             if(cv.hit()) {
  415.                 if(cv.is_checked())
  416.                     cv.uncheck();
  417.                 else
  418.                     cv.check();
  419.                 while(the_mouse.LBP());
  420.                 }
  421.             if(ch.hit()) {
  422.                 if(ch.is_checked())
  423.                     ch.uncheck();
  424.                 else
  425.                     ch.check();
  426.                 while(the_mouse.LBP());
  427.                 }
  428.             if(OK.hit()) {
  429.                 OK.press();
  430.                 while(OK.hit() && the_mouse.LBP());
  431.                 OK.show();
  432.                 if((atoi(wd.getstring())<5) ||
  433.                    (atoi(ht.getstring())<5)) {
  434.                     beep();
  435.                     continue;
  436.                     }
  437.                 if(OK.hit())
  438.                     ready=1;
  439.                 }
  440.             if(CANCEL.hit()) {
  441.                 CANCEL.press();
  442.                 while(CANCEL.hit() && the_mouse.LBP());
  443.                 CANCEL.show();
  444.                 if(CANCEL.hit()) {
  445.                     redraw_screen();
  446.                     return 0;
  447.                     }
  448.                 }
  449.             }//if LBP
  450.         }//while !ready
  451.  
  452.     strcpy(the_bevelrec->name,name.getstring());
  453.     int newulx=atoi(ulx.getstring());
  454.     int newuly=atoi(uly.getstring());
  455.     int neww=atoi(wd.getstring());
  456.     int newh=atoi(ht.getstring());
  457.     int newthickorthin=thin.is_checked();
  458.     if(cv.is_checked())
  459.         newuly=((getmaxy()/2)-(newh/2));
  460.     if(ch.is_checked())
  461.         newulx=((getmaxx()/2)-(neww/2));
  462.  
  463.     the_bevelrec->bevel->reinit(newulx,newuly,neww,newh,newthickorthin);
  464.  
  465.     redraw_screen();
  466.     return 1;
  467. }
  468.  
  469. //*************************************************************************
  470. //        MODIFY_CHECKBOX
  471. //*************************************************************************
  472.  
  473. int modify_checkbox(checkboxrec * the_checkboxrec)
  474. {
  475.     char ULX[4],ULY[4],T[20];
  476.     int ready=0;
  477.  
  478. //*****   INITIALIZE THE DIALOG BOX   *****
  479.  
  480.     the_mouse.changeto(ARROW);
  481.     Bevel box;
  482.     box.init(140,148,358,160,THICK);
  483.     box.show();
  484.  
  485.     Panel panel1;
  486.     panel1.init(156,256,327,37,IN,THIN);
  487.     panel1.show();
  488.  
  489.     Button button1;
  490.     button1.init(460,163,"check",IMAGE);
  491.     Button OK;
  492.     OK.init(224,265,"   OK   ",TEXT);
  493.     Button CANCEL;
  494.     CANCEL.init(342,265," CANCEL ",TEXT);
  495.     button1.show();
  496.     OK.show();
  497.     CANCEL.show();
  498.  
  499.     Gstring name;
  500.     name.init(245,174,20,1);
  501.     name.preset(the_checkboxrec->name);
  502.     Gstring cont;
  503.     cont.init(245,202,20,1);
  504.     cont.preset(the_checkboxrec->checkbox->Gettext());
  505.     Gstring ulx;
  506.     ulx.init(245,232,3,0);
  507.     itoa(the_checkboxrec->checkbox->Getx(),ULX,10);
  508.     ulx.preset(ULX);
  509.     Gstring uly;
  510.     uly.init(375,233,3,1);
  511.     itoa(the_checkboxrec->checkbox->Gety(),ULY,10);
  512.     uly.preset(ULY);
  513.     name.show();
  514.     cont.show();
  515.     ulx.show();
  516.     uly.show();
  517.  
  518.     Gtext text1;
  519.     text1.init(185,171,"Name:",0,7,1);
  520.     Gtext text2;
  521.     text2.init(152,199,"Contents:",0,7,1);
  522.     Gtext text3;
  523.     text3.init(192,230,"ULX:",0,7,1);
  524.     Gtext text4;
  525.     text4.init(325,230,"ULY:",0,7,1);
  526.     text1.show();
  527.     text2.show();
  528.     text3.show();
  529.     text4.show();
  530.  
  531. //*****   INPUT LOOP   *****
  532.  
  533.     name.get_form_mouse_input();
  534.     while(!ready) {
  535.         if(the_mouse.LBP()) {
  536.             if(name.hit()) {
  537.                 while(the_mouse.LBP());
  538.                 name.get_form_mouse_input();
  539.                 }
  540.             if(ulx.hit()) {
  541.                 while(the_mouse.LBP());
  542.                 ulx.get_form_mouse_input();
  543.                 }
  544.             if(uly.hit()) {
  545.                 while(the_mouse.LBP());
  546.                 uly.get_form_mouse_input();
  547.                 }
  548.             if(cont.hit()) {
  549.                 while(the_mouse.LBP());
  550.                 cont.get_form_mouse_input();
  551.                 }
  552.             if(OK.hit()) {
  553.                 OK.press();
  554.                 while(OK.hit() && the_mouse.LBP());
  555.                 OK.show();
  556.                 if(OK.hit())
  557.                     ready=1;
  558.                 }
  559.             if(CANCEL.hit()) {
  560.                 CANCEL.press();
  561.                 while(CANCEL.hit() && the_mouse.LBP());
  562.                 CANCEL.show();
  563.                 if(CANCEL.hit()) {
  564.                     redraw_screen();
  565.                     return 0;
  566.                     }
  567.                 }
  568.             }//if LBP
  569.         }//while !ready
  570.  
  571.     strcpy(the_checkboxrec->name,name.getstring());
  572.     int newulx=atoi(ulx.getstring());
  573.     int newuly=atoi(uly.getstring());
  574.     char * newtext=cont.getstring();
  575.     the_checkboxrec->checkbox->reinit(newulx,newuly,newtext);
  576.  
  577.     redraw_screen();
  578.     return 1;
  579. }
  580.  
  581. //*************************************************************************
  582. //        MODIFY_RADIO
  583. //*************************************************************************
  584.  
  585. int modify_radio(radiorec *the_radiorec)
  586. {
  587.     char ULX[4],ULY[4],T[20];
  588.     int ready=0;
  589.  
  590. //*****   INITIALIZE THE DIALOG BOX   *****
  591.  
  592.     the_mouse.changeto(ARROW);
  593.     Bevel box;
  594.     box.init(140,148,358,160,THICK);
  595.     box.show();
  596.  
  597.     Panel panel1;
  598.     panel1.init(156,256,327,37,IN,THIN);
  599.     panel1.show();
  600.  
  601.     Button button1;
  602.     button1.init(460,163,"radio",IMAGE);
  603.     Button OK;
  604.     OK.init(224,265,"   OK   ",TEXT);
  605.     Button CANCEL;
  606.     CANCEL.init(342,265," CANCEL ",TEXT);
  607.     button1.show();
  608.     OK.show();
  609.     CANCEL.show();
  610.  
  611.     Gstring name;
  612.     name.init(245,174,20,1);
  613.     name.preset(the_radiorec->name);
  614.     Gstring cont;
  615.     cont.init(245,202,20,1);
  616.     cont.preset(the_radiorec->radio->Gettext());
  617.     Gstring ulx;
  618.     ulx.init(245,232,3,0);
  619.     itoa(the_radiorec->radio->Getx(),ULX,10);
  620.     ulx.preset(ULX);
  621.     Gstring uly;
  622.     uly.init(375,233,3,1);
  623.     itoa(the_radiorec->radio->Gety(),ULY,10);
  624.     uly.preset(ULY);
  625.     name.show();
  626.     cont.show();
  627.     ulx.show();
  628.     uly.show();
  629.  
  630.     Gtext text1;
  631.     text1.init(185,171,"Name:",0,7,1);
  632.     Gtext text2;
  633.     text2.init(152,199,"Contents:",0,7,1);
  634.     Gtext text3;
  635.     text3.init(192,230,"ULX:",0,7,1);
  636.     Gtext text4;
  637.     text4.init(325,230,"ULY:",0,7,1);
  638.     text1.show();
  639.     text2.show();
  640.     text3.show();
  641.     text4.show();
  642.  
  643. //*****   INPUT LOOP   *****
  644.  
  645.     name.get_form_mouse_input();
  646.     while(!ready) {
  647.         if(the_mouse.LBP()) {
  648.             if(name.hit()) {
  649.                 while(the_mouse.LBP());
  650.                 name.get_form_mouse_input();
  651.                 }
  652.             if(ulx.hit()) {
  653.                 while(the_mouse.LBP());
  654.                 ulx.get_form_mouse_input();
  655.                 }
  656.             if(uly.hit()) {
  657.                 while(the_mouse.LBP());
  658.                 uly.get_form_mouse_input();
  659.                 }
  660.             if(cont.hit()) {
  661.                 while(the_mouse.LBP());
  662.                 cont.get_form_mouse_input();
  663.                 }
  664.             if(OK.hit()) {
  665.                 OK.press();
  666.                 while(OK.hit() && the_mouse.LBP());
  667.                 OK.show();
  668.                 if(OK.hit())
  669.                     ready=1;
  670.                 }
  671.             if(CANCEL.hit()) {
  672.                 CANCEL.press();
  673.                 while(CANCEL.hit() && the_mouse.LBP());
  674.                 CANCEL.show();
  675.                 if(CANCEL.hit()) {
  676.                     redraw_screen();
  677.                     return 0;
  678.                     }
  679.                 }
  680.             }//if LBP
  681.         }//while !ready
  682.  
  683.     strcpy(the_radiorec->name,name.getstring());
  684.     int newulx=atoi(ulx.getstring());
  685.     int newuly=atoi(uly.getstring());
  686.     char * newtext=cont.getstring();
  687.  
  688.     the_radiorec->radio->reinit(newulx,newuly,newtext);
  689.  
  690.     redraw_screen();
  691.     return 1;
  692. }
  693.  
  694. //*************************************************************************
  695. //        MODIFY_ICON
  696. //*************************************************************************
  697.  
  698. int modify_icon(iconrec *the_iconrec)
  699. {
  700.     char ULX[4],ULY[4],T[20];
  701.     int ready=0;
  702.  
  703. //*****   INITIALIZE THE DIALOG BOX   *****
  704.  
  705.     the_mouse.changeto(ARROW);
  706.     Bevel box;
  707.     box.init(128,90,342,215,THICK);
  708.     box.show();
  709.  
  710.     Panel panel2;
  711.     panel2.init(258,172,192,54,IN,THIN);
  712.     Panel panel3;
  713.     panel3.init(153,239,297,50,IN,THIN);
  714.     panel2.show();
  715.     panel3.show();
  716.  
  717.     Button button1;
  718.     button1.init(431,104,"icon",IMAGE);
  719.     Button OK;
  720.     OK.init(209,253,"   OK   ",TEXT);
  721.     Button CANCEL;
  722.     CANCEL.init(318,253," CANCEL ",TEXT);
  723.     button1.show();
  724.     OK.show();
  725.     CANCEL.show();
  726.  
  727.     Gstring name;
  728.     name.init(203,118,20,1);
  729.     name.preset(the_iconrec->name);
  730.     Gstring ulx;
  731.     ulx.init(203,181,3,0);
  732.     itoa(the_iconrec->icon->Getx(),ULX,10);
  733.     ulx.preset(ULX);
  734.     Gstring uly;
  735.     uly.init(203,217,3,0);
  736.     itoa(the_iconrec->icon->Gety(),ULY,10);
  737.     uly.preset(ULY);
  738.     Gstring cont;
  739.     cont.init(203,149,20,1);
  740.     char filename[13];
  741.     strcpy(filename,the_iconrec->icon->Getfilename());
  742.     cont.preset(filename);
  743.     name.show();
  744.     ulx.show();
  745.     uly.show();
  746.     cont.show();
  747.  
  748.     Gcheckbox cv;
  749.     cv.init(268,182,"Center Vertically");
  750.     Gcheckbox ch;
  751.     ch.init(268,203,"Center Horizontally");
  752.     cv.show();
  753.     ch.show();
  754.  
  755.     Gtext text1;
  756.     text1.init(146,117,"Name:",0,7,1);
  757.     Gtext text2;
  758.     text2.init(155,179,"ULX:",0,7,1);
  759.     Gtext text3;
  760.     text3.init(155,215,"ULY:",0,7,1);
  761.     Gtext text6;
  762.     text6.init(146,146,"Cont:",0,7,1);
  763.     text1.show();
  764.     text2.show();
  765.     text3.show();
  766.     text6.show();
  767.  
  768. //*****   INPUT LOOP   *****
  769.  
  770.     name.get_form_mouse_input();
  771.     while(!ready) {
  772.         if(the_mouse.LBP()) {
  773.             if(name.hit()) {
  774.                 while(the_mouse.LBP());
  775.                 name.get_form_mouse_input();
  776.                 }
  777.             if(ulx.hit()) {
  778.                 while(the_mouse.LBP());
  779.                 ulx.get_form_mouse_input();
  780.                 }
  781.             if(uly.hit()) {
  782.                 while(the_mouse.LBP());
  783.                 uly.get_form_mouse_input();
  784.                 }
  785.             if(cont.hit()) {
  786.                 while(the_mouse.LBP());
  787.                 cont.get_form_mouse_input();
  788.                 }
  789.             if(cv.hit()) {
  790.                 if(cv.is_checked())
  791.                     cv.uncheck();
  792.                 else
  793.                     cv.check();
  794.                 while(the_mouse.LBP());
  795.                 }
  796.             if(ch.hit()) {
  797.                 if(ch.is_checked())
  798.                     ch.uncheck();
  799.                 else
  800.                     ch.check();
  801.                 while(the_mouse.LBP());
  802.                 }
  803.             if(OK.hit()) {
  804.                 OK.press();
  805.                 while(OK.hit() && the_mouse.LBP());
  806.                 OK.show();
  807.                 if(OK.hit())
  808.                     ready=1;
  809.                 }
  810.             if(CANCEL.hit()) {
  811.                 CANCEL.press();
  812.                 while(CANCEL.hit() && the_mouse.LBP());
  813.                 CANCEL.show();
  814.                 if(CANCEL.hit()) {
  815.                     redraw_screen();
  816.                     return 0;
  817.                     }
  818.                 }
  819.             }//if LBP
  820.         }//while !ready
  821.  
  822.     strcpy(the_iconrec->name,name.getstring());
  823.     int newulx=atoi(ulx.getstring());
  824.     int newuly=atoi(uly.getstring());
  825.     char * newtext=cont.getstring();
  826.     if(cv.is_checked())
  827.         newuly=((getmaxy()/2)-(the_iconrec->icon->Getw()/2));
  828.     if(ch.is_checked())
  829.         newulx=((getmaxx()/2)-(the_iconrec->icon->Geth()/2));
  830.  
  831.     the_iconrec->icon->reinit(newulx,newuly,newtext);
  832.  
  833.     redraw_screen();
  834.     return 1;
  835. }
  836.  
  837. //*************************************************************************
  838. //        MODIFY_STRING
  839. //*************************************************************************
  840.  
  841. int modify_string(stringrec *the_stringrec)
  842. {
  843.     char ULX[4],ULY[4],T[20];
  844.     int ready=0;
  845.  
  846. //*****   INITIALIZE THE DIALOG BOX   *****
  847.  
  848.     the_mouse.changeto(ARROW);
  849.     Bevel box;
  850.     box.init(140,148,358,160,THICK);
  851.     box.show();
  852.  
  853.     Panel panel1;
  854.     panel1.init(156,256,327,37,IN,THIN);
  855.     panel1.show();
  856.  
  857.     Button button1;
  858.     button1.init(460,163,"gstring",IMAGE);
  859.     Button OK;
  860.     OK.init(303,265,"   OK   ",TEXT);
  861.     Button CANCEL;
  862.     CANCEL.init(393,265," CANCEL ",TEXT);
  863.     button1.show();
  864.     OK.show();
  865.     CANCEL.show();
  866.  
  867.     Gstring name;
  868.     name.init(245,174,20,1);
  869.     name.preset(the_stringrec->name);
  870.     Gstring len;
  871.     len.init(245,202,2,0);
  872.     char L[3];
  873.     itoa(the_stringrec->string->Getlength(),L,10);
  874.     len.preset(L);
  875.     Gstring ulx;
  876.     ulx.init(245,232,3,0);
  877.     itoa(the_stringrec->string->Getx(),ULX,10);
  878.     ulx.preset(ULX);
  879.     Gstring uly;
  880.     uly.init(375,233,3,1);
  881.     itoa(the_stringrec->string->Gety(),ULY,10);
  882.     uly.preset(ULY);
  883.     name.show();
  884.     len.show();
  885.     ulx.show();
  886.     uly.show();
  887.  
  888.     Gcheckbox uc;
  889.     uc.init(167,269,"Uppercase");
  890.     uc.show();
  891.     if(the_stringrec->string->is_ucase())
  892.         uc.check();
  893.  
  894.     Gtext text1;
  895.     text1.init(185,171,"Name:",0,7,1);
  896.     Gtext text2;
  897.     text2.init(169,199,"Length:",0,7,1);
  898.     Gtext text3;
  899.     text3.init(192,230,"ULX:",0,7,1);
  900.     Gtext text4;
  901.     text4.init(325,230,"ULY:",0,7,1);
  902.     text1.show();
  903.     text2.show();
  904.     text3.show();
  905.     text4.show();
  906.  
  907. //*****   INPUT LOOP   *****
  908.  
  909.     name.get_form_mouse_input();
  910.     while(!ready) {
  911.         if(the_mouse.LBP()) {
  912.             if(name.hit()) {
  913.                 while(the_mouse.LBP());
  914.                 name.get_form_mouse_input();
  915.                 }
  916.             if(ulx.hit()) {
  917.                 while(the_mouse.LBP());
  918.                 ulx.get_form_mouse_input();
  919.                 }
  920.             if(uly.hit()) {
  921.                 while(the_mouse.LBP());
  922.                 uly.get_form_mouse_input();
  923.                 }
  924.             if(len.hit()) {
  925.                 while(the_mouse.LBP());
  926.                 len.get_form_mouse_input();
  927.                 }
  928.             if(uc.hit()) {
  929.                 if(uc.is_checked())
  930.                     uc.uncheck();
  931.                 else
  932.                     uc.check();
  933.                 while(the_mouse.LBP());
  934.                 }
  935.             if(OK.hit()) {
  936.                 OK.press();
  937.                 while(OK.hit() && the_mouse.LBP());
  938.                 OK.show();
  939.                 if(OK.hit())
  940.                     ready=1;
  941.                 }
  942.             if(CANCEL.hit()) {
  943.                 CANCEL.press();
  944.                 while(CANCEL.hit() && the_mouse.LBP());
  945.                 CANCEL.show();
  946.                 if(CANCEL.hit()) {
  947.                     redraw_screen();
  948.                     return 0;
  949.                     }
  950.                 }
  951.             }//if LBP
  952.         }//while !ready
  953.  
  954.     strcpy(the_stringrec->name,name.getstring());
  955.     int newulx=atoi(ulx.getstring());
  956.     int newuly=atoi(uly.getstring());
  957.     int newlen=atoi(len.getstring());
  958.  
  959.     the_stringrec->string->reinit(newulx,newuly,newlen,uc.is_checked());
  960.  
  961.     redraw_screen();
  962.     return 1;
  963. }
  964.  
  965. //*************************************************************************
  966. //        MODIFY_BUTTON
  967. //*************************************************************************
  968.  
  969. int modify_button(buttonrec *the_buttonrec)
  970. {
  971.     char ULX[4],ULY[4],T[20];
  972.     int ready=0;
  973.  
  974. //*****   INITIALIZE THE DIALOG BOX   *****
  975.  
  976.     the_mouse.changeto(ARROW);
  977.     Bevel box;
  978.     box.init(128,90,345,228,THICK,SAVEBGD);
  979.     box.show();
  980.  
  981.     Panel panel1;
  982.     panel1.init(154,239,82,49,IN,THIN);
  983.     Panel panel2;
  984.     panel2.init(258,172,192,54,IN,THIN);
  985.     Panel panel3;
  986.     panel3.init(258,239,193,49,IN,THIN);
  987.     panel1.show();
  988.     panel2.show();
  989.     panel3.show();
  990.  
  991.     Button button1;
  992.     button1.init(431,104,"button",IMAGE);
  993.     Button OK;
  994.     OK.init(274,253,"   OK   ",TEXT);
  995.     Button CANCEL;
  996.     CANCEL.init(360,253," CANCEL ",TEXT);
  997.     button1.show();
  998.     OK.show();
  999.     CANCEL.show();
  1000.  
  1001.     Gstring name;
  1002.     name.init(203,118,20,1);
  1003.     name.preset(the_buttonrec->name);
  1004.     Gstring ulx;
  1005.     ulx.init(203,181,3,0);
  1006.     itoa(the_buttonrec->button->Getx(),ULX,10);
  1007.     ulx.preset(ULX);
  1008.     Gstring uly;
  1009.     uly.init(203,217,3,0);
  1010.     itoa(the_buttonrec->button->Gety(),ULY,10);
  1011.     uly.preset(ULY);
  1012.     Gstring cont;
  1013.     cont.init(203,149,20,1);
  1014.     cont.preset(the_buttonrec->button->Getcontents());
  1015.     name.show();
  1016.     ulx.show();
  1017.     uly.show();
  1018.     cont.show();
  1019.  
  1020.     Gradio text;
  1021.     text.init(163,247,"Text");
  1022.     Gradio img;
  1023.     img.init(163,267,"Image");
  1024.     text.show();
  1025.     img.show();
  1026.     if(the_buttonrec->button->Getformat()==TEXT)
  1027.         text.check();
  1028.     else
  1029.         img.check();
  1030.  
  1031.     Gcheckbox cv;
  1032.     cv.init(268,182,"Center Vertically");
  1033.     Gcheckbox ch;
  1034.     ch.init(268,203,"Center Horizontally");
  1035.     cv.show();
  1036.     ch.show();
  1037.  
  1038.     Gtext text1;
  1039.     text1.init(146,117,"Name:",0,7,1);
  1040.     Gtext text2;
  1041.     text2.init(155,179,"ULX:",0,7,1);
  1042.     Gtext text3;
  1043.     text3.init(155,215,"ULY:",0,7,1);
  1044.     Gtext text6;
  1045.     text6.init(146,146,"Cont:",0,7,1);
  1046.     text1.show();
  1047.     text2.show();
  1048.     text3.show();
  1049.     text6.show();
  1050.  
  1051. //*****   INPUT LOOP   *****
  1052.  
  1053.     name.get_form_mouse_input();
  1054.     while(!ready) {
  1055.         if(the_mouse.LBP()) {
  1056.             if(name.hit()) {
  1057.                 while(the_mouse.LBP());
  1058.                 name.get_form_mouse_input();
  1059.                 }
  1060.             if(ulx.hit()) {
  1061.                 while(the_mouse.LBP());
  1062.                 ulx.get_form_mouse_input();
  1063.                 }
  1064.             if(uly.hit()) {
  1065.                 while(the_mouse.LBP());
  1066.                 uly.get_form_mouse_input();
  1067.                 }
  1068.             if(cont.hit()) {
  1069.                 while(the_mouse.LBP());
  1070.                 cont.get_form_mouse_input();
  1071.                 }
  1072.             if(cv.hit()) {
  1073.                 if(cv.is_checked())
  1074.                     cv.uncheck();
  1075.                 else
  1076.                     cv.check();
  1077.                 while(the_mouse.LBP());
  1078.                 }
  1079.             if(ch.hit()) {
  1080.                 if(ch.is_checked())
  1081.                     ch.uncheck();
  1082.                 else
  1083.                     ch.check();
  1084.                 while(the_mouse.LBP());
  1085.                 }
  1086.             if(text.hit()) {
  1087.                 if(!text.is_checked()) {
  1088.                     text.check();
  1089.                     img.uncheck();
  1090.                     }
  1091.                 while(the_mouse.LBP());
  1092.                 }
  1093.             if(img.hit()) {
  1094.                 if(!img.is_checked()) {
  1095.                     img.check();
  1096.                     text.uncheck();
  1097.                     }
  1098.                 while(the_mouse.LBP());
  1099.                 }
  1100.             if(OK.hit()) {
  1101.                 OK.press();
  1102.                 while(OK.hit() && the_mouse.LBP());
  1103.                 OK.show();
  1104.                 if(OK.hit()) {
  1105.                     box.hide();
  1106.                     box.elim();
  1107.                     ready=1;
  1108.                     }
  1109.                 }
  1110.             if(CANCEL.hit()) {
  1111.                 CANCEL.press();
  1112.                 while(CANCEL.hit() && the_mouse.LBP());
  1113.                 CANCEL.show();
  1114.                 if(CANCEL.hit()) {
  1115.                     box.hide();
  1116.                     box.elim();
  1117.                     return 0;
  1118.                     }
  1119.                 }
  1120.             }//if LBP
  1121.         }//while !ready
  1122.  
  1123.     strcpy(the_buttonrec->name,name.getstring());
  1124.     int newulx=atoi(ulx.getstring());
  1125.     int newuly=atoi(uly.getstring());
  1126.     char * newtext=cont.getstring();
  1127.     if(cv.is_checked())
  1128.         newuly=((getmaxy()/2)-(the_buttonrec->button->Geth()/2));
  1129.     if(ch.is_checked())
  1130.         newulx=((getmaxx()/2)-(the_buttonrec->button->Getw()/2));
  1131.  
  1132.     the_buttonrec->button->reinit(newulx,newuly,newtext,img.is_checked());
  1133.     redraw_screen();
  1134.     return 1;
  1135. }
  1136.  
  1137. //**************************************************************************
  1138. //        MODIFY_TEXT
  1139. //**************************************************************************
  1140.  
  1141. int modify_text(textrec *the_textrec)
  1142. {
  1143.     char ULX[4],ULY[4],T[20];
  1144.     int fgd,bgd;
  1145.     int size;
  1146.     int ready=0;
  1147.     Colorbutton fg[16],bg[16];
  1148.  
  1149. //*****   INITIALIZE THE DIALOG BOX   *****
  1150.  
  1151.     the_mouse.changeto(ARROW);
  1152.  
  1153.     Bevel box;
  1154.     box.init(115,141,471,279,THICK);
  1155.     box.show();
  1156.  
  1157.     Panel panel1;
  1158.     panel1.init(137,339,187,61,IN,THIN);
  1159.     Panel panel2;
  1160.     panel2.init(137,248,104,80,IN,THIN);
  1161.     Panel panel3;
  1162.     panel3.init(348,339,213,63,IN,THIN);
  1163.     Panel panel4;
  1164.     panel4.init(250,248,312,80,IN,THIN);
  1165.     panel1.show();
  1166.     panel2.show();
  1167.     panel3.show();
  1168.     panel4.show();
  1169.  
  1170.     Button OK;
  1171.     OK.init(368,360,"   OK   ",TEXT);
  1172.     Button CANCEL;
  1173.     CANCEL.init(462,359," CANCEL ",TEXT);
  1174.     Button textbutton;
  1175.     textbutton.init(551,152,"text",IMAGE);
  1176.     OK.show();
  1177.     CANCEL.show();
  1178.     textbutton.show();
  1179.  
  1180.     Gstring name;
  1181.     name.init(227,167,20,0);
  1182.     name.preset(the_textrec->name);
  1183.     Gstring cont;
  1184.     cont.init(227,197,40,0);
  1185.     cont.preset(the_textrec->text->Gettext());
  1186.     Gstring ulx;
  1187.     ulx.init(227,227,3,0);
  1188.     itoa(the_textrec->text->Getx(),ULX,10);
  1189.         ulx.preset(ULX);
  1190.     Gstring uly;
  1191.     uly.init(338,227,3,0);
  1192.     itoa(the_textrec->text->Gety(),ULY,10);
  1193.     uly.preset(ULY);
  1194.     name.show();
  1195.     cont.show();
  1196.     ulx.show();
  1197.     uly.show();
  1198.  
  1199.     Gradio small;
  1200.     small.init(152,261,"Small");
  1201.     Gradio med;
  1202.     med.init(152,282,"Medium");
  1203.     Gradio large;
  1204.     large.init(152,303,"Large");
  1205.     small.show();
  1206.     med.show();
  1207.     large.show();
  1208.     size=the_textrec->text->Getsize();
  1209.     switch(size) {
  1210.         case 1: small.check();
  1211.                 break;
  1212.         case 2: med.check();
  1213.                 break;
  1214.         case 3: large.check();
  1215.         }
  1216.  
  1217.     Gcheckbox cv;
  1218.     cv.init(143,377,"Center Vertically");
  1219.     Gcheckbox ch;
  1220.     ch.init(143,350,"Center Horizontally");
  1221.     cv.show();
  1222.     ch.show();
  1223.  
  1224.     Gtext text1;
  1225.     text1.init(168,164,"Name:",0,7,1);
  1226.     Gtext text2;
  1227.     text2.init(136,194,"Contents:",0,7,1);
  1228.     Gtext text3;
  1229.     text3.init(176,224,"ULX:",0,7,1);
  1230.     Gtext text4;
  1231.     text4.init(290,224,"ULY:",0,7,1);
  1232.     text1.show();
  1233.     text2.show();
  1234.     text3.show();
  1235.     text4.show();
  1236.  
  1237.     setcolor(0);
  1238.     settextjustify(LEFT_TEXT,TOP_TEXT);
  1239.     settextstyle(0,0,1);
  1240.     gprintxy(265,268,"Foreground:");
  1241.     gprintxy(265,298,"Background:");
  1242.  
  1243.     for(int i=0;i<16;i++) {
  1244.         fg[i].init(370+(10*i),267,10,10,i);
  1245.         bg[i].init(370+(10*i),297,10,10,i);
  1246.         fg[i].show(0);
  1247.         bg[i].show(0);
  1248.         }
  1249.     fgd=the_textrec->text->Getfgd();
  1250.     bgd=the_textrec->text->Getbgd();
  1251.     fg[fgd].show(15);
  1252.     bg[bgd].show(15);
  1253.  
  1254. //*****   INPUT LOOP   *****
  1255.  
  1256.     name.get_form_mouse_input();
  1257.     while(!ready) {
  1258.         if(the_mouse.LBP()) {
  1259.             for(i=0;i<16;i++) {
  1260.                 if(fg[i].hit()) {
  1261.                     fg[fgd].show(0);
  1262.                     fgd=i;
  1263.                     fg[fgd].show(15);
  1264.                     while(the_mouse.LBP());
  1265.                     continue;
  1266.                     }
  1267.                 if(bg[i].hit()) {
  1268.                     bg[bgd].show(0);
  1269.                     bgd=i;
  1270.                     bg[bgd].show(15);
  1271.                     while(the_mouse.LBP());
  1272.                     continue;
  1273.                     }
  1274.                 }
  1275.             if(name.hit()) {
  1276.                 while(the_mouse.LBP());
  1277.                 name.get_form_mouse_input();
  1278.                 }
  1279.             if(ulx.hit()) {
  1280.                 while(the_mouse.LBP());
  1281.                 ulx.get_form_mouse_input();
  1282.                 }
  1283.             if(uly.hit()) {
  1284.                 while(the_mouse.LBP());
  1285.                 uly.get_form_mouse_input();
  1286.                 }
  1287.             if(cont.hit()) {
  1288.                 while(the_mouse.LBP());
  1289.                 cont.get_form_mouse_input();
  1290.                 }
  1291.             if(cv.hit()) {
  1292.                 if(cv.is_checked())
  1293.                     cv.uncheck();
  1294.                 else
  1295.                     cv.check();
  1296.                 while(the_mouse.LBP());
  1297.                 }
  1298.             if(ch.hit()) {
  1299.                 if(ch.is_checked())
  1300.                     ch.uncheck();
  1301.                 else
  1302.                     ch.check();
  1303.                 while(the_mouse.LBP());
  1304.                 }
  1305.             if(small.hit()) {
  1306.                 if(!small.is_checked()) {
  1307.                     small.check();
  1308.                     med.uncheck();
  1309.                     large.uncheck();
  1310.                     }
  1311.                 while(the_mouse.LBP());
  1312.                 }
  1313.             if(med.hit()) {
  1314.                 if(!med.is_checked()) {
  1315.                     med.check();
  1316.                     small.uncheck();
  1317.                     large.uncheck();
  1318.                     }
  1319.                 while(the_mouse.LBP());
  1320.                 }
  1321.             if(large.hit()) {
  1322.                 if(!large.is_checked()) {
  1323.                     large.check();
  1324.                     med.uncheck();
  1325.                     small.uncheck();
  1326.                     }
  1327.                 while(the_mouse.LBP());
  1328.                 }
  1329.             if(OK.hit()) {
  1330.                 OK.press();
  1331.                 while(OK.hit() && the_mouse.LBP());
  1332.                 OK.show();
  1333.                 if(OK.hit())
  1334.                     ready=1;
  1335.                 }
  1336.             if(CANCEL.hit()) {
  1337.                 CANCEL.press();
  1338.                 while(CANCEL.hit() && the_mouse.LBP());
  1339.                 CANCEL.show();
  1340.                 if(CANCEL.hit()) {
  1341.                     redraw_screen();
  1342.                     return 0;
  1343.                     }
  1344.                 }
  1345.             }//if LBP
  1346.         }//while !ready
  1347.  
  1348.     strcpy(the_textrec->name,name.getstring());
  1349.     int newulx=atoi(ulx.getstring());
  1350.     int newuly=atoi(uly.getstring());
  1351.     char * newtext=cont.getstring();
  1352.     if(cv.is_checked()) {
  1353.         settextstyle(0,0,size);
  1354.         newuly=((getmaxy()/2)-(textheight("H")/2));
  1355.         settextstyle(0,0,1);
  1356.         }
  1357.     if(ch.is_checked()) {
  1358.         settextstyle(0,0,size);
  1359.         newulx=((getmaxx()/2)-((textwidth(newtext))/2));
  1360.         settextstyle(0,0,1);
  1361.         }
  1362.     if(small.is_checked())
  1363.         size=1;
  1364.     else
  1365.     if(med.is_checked())
  1366.         size=2;
  1367.     else
  1368.     if(large.is_checked())
  1369.         size=3;
  1370.  
  1371.     the_textrec->text->reinit(newulx,newuly,newtext,fgd,bgd,size);
  1372.  
  1373.     redraw_screen();
  1374.     return 1;
  1375. }
  1376.